Telegram Group & Telegram Channel
Note #33: Разбор доклада Marwan Sulaiman - Handling Go Errors GopherCon 2019

Марван рассказывает и показывает как они обрабатывают ошибки в New York Times. Основная идея доклада в том, что у вас есть доменная модель и работать с ошибками необходимо по аналогии как Вы работаете с вашей доменной моделью. Делается это лучше всего, в виде type Error struct в пакете errors:
package Errors

// based on https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23
type Error struct {
// a unique string describing a method or a function e.g. getUser
Op op

// can be predefined code/or own code (http/gRPC)
Kind kind

// you can add severity
Severity logrus.Level

// You can add any application Specific Data e.g.
ZipCode string
CreatedAt time.Time
}

Вариант использование:
if err != nil {
return &errors.Error{Op: “getUser”, Error: err}
}

По сути это доклад - это пересечение двух статей [2] и [3] с примерам и подробным описанием что означает каждое поле в структуре Error. Также Марван показывает несколько утилит которые помогают работать с такими ошибками (большая часть из проекта Upspin).

Данный подход помогает не только быстро понять, что и где сломалось в контексте приложения, но и легко настроить фильтры в системе логирования и мониторинга.
Если тема Вам близка то я рекомендую посмотреть видео [1] и/или прочитать еще раз эти статьи [2][3]:

Links:
[1] https://www.youtube.com/watch?v=4WIhhzTTd0Y
[2] https://middlemost.com/failure-is-your-domain/
[3] https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html
[4] https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23



tg-me.com/golang_for_two/58
Create:
Last Update:

Note #33: Разбор доклада Marwan Sulaiman - Handling Go Errors GopherCon 2019

Марван рассказывает и показывает как они обрабатывают ошибки в New York Times. Основная идея доклада в том, что у вас есть доменная модель и работать с ошибками необходимо по аналогии как Вы работаете с вашей доменной моделью. Делается это лучше всего, в виде type Error struct в пакете errors:

package Errors

// based on https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23
type Error struct {
// a unique string describing a method or a function e.g. getUser
Op op

// can be predefined code/or own code (http/gRPC)
Kind kind

// you can add severity
Severity logrus.Level

// You can add any application Specific Data e.g.
ZipCode string
CreatedAt time.Time
}

Вариант использование:
if err != nil {
return &errors.Error{Op: “getUser”, Error: err}
}

По сути это доклад - это пересечение двух статей [2] и [3] с примерам и подробным описанием что означает каждое поле в структуре Error. Также Марван показывает несколько утилит которые помогают работать с такими ошибками (большая часть из проекта Upspin).

Данный подход помогает не только быстро понять, что и где сломалось в контексте приложения, но и легко настроить фильтры в системе логирования и мониторинга.
Если тема Вам близка то я рекомендую посмотреть видео [1] и/или прочитать еще раз эти статьи [2][3]:

Links:
[1] https://www.youtube.com/watch?v=4WIhhzTTd0Y
[2] https://middlemost.com/failure-is-your-domain/
[3] https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html
[4] https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23

BY 🇺🇦 Go for two :)


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/golang_for_two/58

View MORE
Open in Telegram


🇺🇦 Go на двоих Telegram | DID YOU KNOW?

Date: |

What is Telegram?

Telegram is a cloud-based instant messaging service that has been making rounds as a popular option for those who wish to keep their messages secure. Telegram boasts a collection of different features, but it’s best known for its ability to secure messages and media by encrypting them during transit; this prevents third-parties from snooping on messages easily. Let’s take a look at what Telegram can do and why you might want to use it.

The STAR Market, as is implied by the name, is heavily geared toward smaller innovative tech companies, in particular those engaged in strategically important fields, such as biopharmaceuticals, 5G technology, semiconductors, and new energy. The STAR Market currently has 340 listed securities. The STAR Market is seen as important for China’s high-tech and emerging industries, providing a space for smaller companies to raise capital in China. This is especially significant for technology companies that may be viewed with suspicion on overseas stock exchanges.

🇺🇦 Go на двоих from sg


Telegram 🇺🇦 Go for two :)
FROM USA